<template>
  <div class="home">
    <div class="name">我的投标</div>
     <el-table :data="list.data" style="width:100%" >
      <el-table-column label="序号" align="center" type="index" width="100"/>
      <el-table-column label="标的名称" align="center" prop="procurementMark.title" />
      <el-table-column label="投标结束时间" align="center" prop="procurementMark.endTime" width="180">
      </el-table-column>
      <el-table-column prop="procurementMark.bidType" label="标状态">
          <template slot-scope="scope">
            {{ bidType(scope.row.procurementMark.bidType) }}
          </template>
        </el-table-column>

      <el-table-column label="操作" align="center" >
        <template slot-scope="scope">
          <el-button
          :disabled="scope.row.procurementMark.bidType == 2"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="submit(scope.row)"
          >提交资料</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        background
        layout="prev, pager, next"
        :total="this.total"
        :current-page.sync="currentPage"
        :page-size="pageSize"
        @current-change="getList"
  >
</el-pagination>
  </div>
</template>

<script>
import {getHaveBidList} from "@/api/procurement/HaveBid"
export default {
data () {
  return{
    dialogVisible: false,
    list: [],
    userRes: {},
    total: 0,
    pageSize: 5,
    currentPage: 1
  }
},
mounted() {
  this.userRes = this.$store.state.user.userRes;
this.getList();
},
methods:{
   bidType(type) {
      if (type == 0) {
        return "资料待提交";
      } else if (type == 1) {
        return "已过期";
      } else if (type == 2) {
        return "资质审核";
      } else if (type == 3) {
        return "待开标";
      } else if (type == 4) {
        return "开标结果";
      } else if (type == 5) {
        return "未报名";
      }
    },
// 获取列表
getList() {
  getHaveBidList({
   pageIndex: this.currentPage,
   pageSize: this.pageSize,
   userId: this.userRes.userId
 }).then((res) =>{
  this.list = res;
  this.total = res.total
 })
},
// 提交资料
submit (item){
this.$router.push({
  name:"targetSubmit",
  query: {
    id: item.id
  }
})
}
}
}
</script>

<style scoped>
.name {
    text-align: center;
    font-size: 30px;
    font-weight: 700;
    padding: 10px 0;
}
.el-pagination {
  float: right;
  margin-top: 20px;
}
</style>